import yaml
import os



def read_yaml(file_path):
    """读取YAML测试数据"""
    print('file_path',file_path)
    try:
        with open(file_path, 'r', encoding='utf-8') as f:
            # print('888888888',yaml.safe_load(f))
            d = yaml.safe_load(f)
            return d
    except Exception as e:
        # logger.error(f"<UNK>: {str(e)}")
        return []

def get_test_data(data_dir, case_name):
    """获取指定用例的测试数据"""
    data_file = os.path.join(os.getcwd(), "data", data_dir, f"{case_name}.yaml")
    print('os data_file',data_file)
    return read_yaml(data_file)